UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OvKf9VIlRCVGODRB/IapOSc11E6CTdjizgXTpYTkOeg=' 
WHERE 
  key_id = '3424b4680c7dd52aad04f8060b1cf4e20ec927373c5d89dc163543388e634eb4' 
  AND (
    token = 'OvKf9VIlRCVGODRB/IapOSc11E6CTdjizgXTpYTkOeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023