UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vYBq7uZjrkiwNcNOSa3LCDp4VZJGTGNDOQfXD7XX+Os=' 
WHERE 
  key_id = '833a65f2354d55214031fcb0c7217a5c527846d489cf8496166f4d5e85a916e7' 
  AND (
    token = 'vYBq7uZjrkiwNcNOSa3LCDp4VZJGTGNDOQfXD7XX+Os=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045