UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TiuXkMJvjw9Jok8hHd0FQuY6AW6B9OadnDMMYeYOucU=' 
WHERE 
  key_id = 'e30d57a30961c8773528e1dc4adef30c33a5f83e9b536eab466703e267169de8' 
  AND (
    token = 'TiuXkMJvjw9Jok8hHd0FQuY6AW6B9OadnDMMYeYOucU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044