UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TsRfPTFuYMpYq/4h/MQ88YsJD64e0GsLHzbGMxFBnfo=' 
WHERE 
  key_id = 'cf5e4904280726fb8bab4b09389a02625d8a229d044578da90026d084b079f3a' 
  AND (
    token = 'TsRfPTFuYMpYq/4h/MQ88YsJD64e0GsLHzbGMxFBnfo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047