UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZHkobMXmPaTMXH3myx6ZcqKBugw+ns4Pu3LPIjw01lc=' 
WHERE 
  key_id = '7496e319692fde8f84bca152476fcab4ad36c44b1fe1280390997f39f7d0c123' 
  AND (
    token = 'ZHkobMXmPaTMXH3myx6ZcqKBugw+ns4Pu3LPIjw01lc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037