UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rg6Z94vcuqVzQvwEEMv8JsN5Yibc9nMUlrPs1X7ehhk=' 
WHERE 
  key_id = '4bdc44a77921bf12b99b47c03934c8496233cb249230dc1f7a025f9ba0f27b44' 
  AND (
    token = 'rg6Z94vcuqVzQvwEEMv8JsN5Yibc9nMUlrPs1X7ehhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031