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

Query time 0.00051