UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ivY9/10MN8rwhoY35QuVix+HNB+TZcUaXVipJUD2U7Q=' 
WHERE 
  key_id = 'df56d0e15f4e78c7b7882959a2a18725e7ee52f5d94d623122ff05b1e17c357d' 
  AND (
    token = 'ivY9/10MN8rwhoY35QuVix+HNB+TZcUaXVipJUD2U7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032