UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JdkZLSERWlIxZK0HkKMXSggCc8PgwwcwTKPHEU/Ia3M=' 
WHERE 
  key_id = '6717cac6da334b66212cc39785540d67e9a3ce2f1fc28c921a0fc330143121f7' 
  AND (
    token = 'JdkZLSERWlIxZK0HkKMXSggCc8PgwwcwTKPHEU/Ia3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056