UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+E6p7MidY0JBF0+ercq+ox6KKU2kKtLmszbmfFyeAzw=' 
WHERE 
  key_id = '262ea47d1599d10a6cc53ff8474c6f51111da96076ae345a9822f4233db0038b' 
  AND (
    token = '+E6p7MidY0JBF0+ercq+ox6KKU2kKtLmszbmfFyeAzw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052