UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BW6k+pi9uU4QGTNfCKAa3pbJAVgS0rXQ8yap/a8MxgU=' 
WHERE 
  key_id = '6781bb2e13026211d89d36eb1ae0c84212fce15b68f677b3cce5238dd36298f4' 
  AND (
    token = 'BW6k+pi9uU4QGTNfCKAa3pbJAVgS0rXQ8yap/a8MxgU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037