UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xifoj48tX5zfc86N/5wpKHvfeSnWaZVZbBDukT4/X3Q=' 
WHERE 
  key_id = '987e13db8b18f6deef32e75732cbbef75701136b4dd5a80a1c49f68d3bd5b441' 
  AND (
    token = 'xifoj48tX5zfc86N/5wpKHvfeSnWaZVZbBDukT4/X3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028