UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ILC//cJpmfc516h0cGOYFQCuXATUhnfphzQBS4KVPw8=' 
WHERE 
  key_id = '6a18b82d3a79b5b6dc8926330c6093aa0ef4182eff24c904fb3f229694afcb5c' 
  AND (
    token = 'ILC//cJpmfc516h0cGOYFQCuXATUhnfphzQBS4KVPw8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044