UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wxrJkcXvkSFbu/cROnoI6kw1ujN0aVz67YKvRaBb2UU=' 
WHERE 
  key_id = 'f9f683cf3005f1c0a8bc17b8172103e51e7546ef38cfae21e74d45ffad101226' 
  AND (
    token = 'wxrJkcXvkSFbu/cROnoI6kw1ujN0aVz67YKvRaBb2UU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036