UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '79ocG9hpJWCDZ65ezyX+NEpLOvh3RU+YD7Bk5s9+m20=' 
WHERE 
  key_id = '7f89d254c620e0ffc2755162e65c15862498520b5c6046a6205aee5f62f9ae24' 
  AND (
    token = '79ocG9hpJWCDZ65ezyX+NEpLOvh3RU+YD7Bk5s9+m20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042