UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BjdNrwFDU8guYlYV+4D/uippnptGE4PbL71+hStGpbQ=' 
WHERE 
  key_id = '94b661789edbd566a754d07812f6c46653f3d8333dca3d648efbf4b8f47e1112' 
  AND (
    token = 'BjdNrwFDU8guYlYV+4D/uippnptGE4PbL71+hStGpbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019