UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D2pltyJJWdaAbE7M02WtW+6kQEVUR9jJ5m3VtSzMm4E=' 
WHERE 
  key_id = '1fd9c5a2ba10c37175748b09ce4af464534530b56a381c319edd00accbd43d04' 
  AND (
    token = 'D2pltyJJWdaAbE7M02WtW+6kQEVUR9jJ5m3VtSzMm4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029