UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EzXCMMWx3xqh8xSCRKs2zrhbTp93EaaaUTUDNqEEfSM=' 
WHERE 
  key_id = '064c2b2c8cf515fdad44fc8cc3b309ab1fc007d018eda8b553f533506db2c920' 
  AND (
    token = 'EzXCMMWx3xqh8xSCRKs2zrhbTp93EaaaUTUDNqEEfSM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029