UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mt5F1brvCbS3mvosAzMiLoxfrghCzneLEHIRkwDB6cc=' 
WHERE 
  key_id = '9843d36105b2bf1318897235a06b90066592e9b1cf8fd15243edc5696e67d08f' 
  AND (
    token = 'mt5F1brvCbS3mvosAzMiLoxfrghCzneLEHIRkwDB6cc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030