UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1ywX52xt+lHDvHfZVezy8MigK+28p4nAkiuKMJKdIWg=' 
WHERE 
  key_id = 'ce5174a70797564c50793bf41decb34b5a2b62d845fbe0dc5d2c470c835f7ea5' 
  AND (
    token = '1ywX52xt+lHDvHfZVezy8MigK+28p4nAkiuKMJKdIWg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038