UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W7kLTGq6SfRIEOmQGRsm//2SaGX7YqXHf5XDWhJkl6Y=' 
WHERE 
  key_id = '1f6b8c74df7770e14b54426b52717101c6e399c7da6c204f91ba314661ee2e31' 
  AND (
    token = 'W7kLTGq6SfRIEOmQGRsm//2SaGX7YqXHf5XDWhJkl6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032