UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7sgq8Z9Xp0I35ukPjPRKI4gF8SKm4okt/Gb8WDWfF3c=' 
WHERE 
  key_id = 'd8b871123f3cbcdb0ca85e1f536feb6fd6ee45bb3b6d60a79336586120384cf3' 
  AND (
    token = '7sgq8Z9Xp0I35ukPjPRKI4gF8SKm4okt/Gb8WDWfF3c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030