UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1RJBZ+PF9f4UiILFI/NSIclstgCeF8Mt2zsF7pXdof8=' 
WHERE 
  key_id = '400bd538d5646eb8342b73f7b4fc521de18d2ffd6f163c27e175d06751d2b052' 
  AND (
    token = '1RJBZ+PF9f4UiILFI/NSIclstgCeF8Mt2zsF7pXdof8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019