UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G6aR8fUaL6fDZZnP4Rhv2+3yFnGHY//HMN/4kMF7Vis=' 
WHERE 
  key_id = '1b4459657d24fe0fc383c430978fa77b64fd30c1be392928434040194c8522e5' 
  AND (
    token = 'G6aR8fUaL6fDZZnP4Rhv2+3yFnGHY//HMN/4kMF7Vis=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037