UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xEl1XTtc8k/Ut2/jKAMW6y//TW/19cgDdrrurNTq1Xc=' 
WHERE 
  key_id = 'e39443b7d4a4d495e8fc739dba5f5ea06849f027d7555df2eb4f62d6b260b95c' 
  AND (
    token = 'xEl1XTtc8k/Ut2/jKAMW6y//TW/19cgDdrrurNTq1Xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027