UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6fJAPZnxzKojA+orLIzngd8PrVZrCSDX793YJ7s7Gfw=' 
WHERE 
  key_id = '6015ec7454c7e2f5d5067713c5c610149c4823994c8c7f33ede5b78de614e1b5' 
  AND (
    token = '6fJAPZnxzKojA+orLIzngd8PrVZrCSDX793YJ7s7Gfw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040