UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7mMWZwaIMCcqeirHeZ/pSOOYfWKUL1MOiMv1s6Iwdtk=' 
WHERE 
  key_id = 'c02e6476b142e7979b74772ed34d62c47f9f7a5f79513688f5b5494b467992a0' 
  AND (
    token = '7mMWZwaIMCcqeirHeZ/pSOOYfWKUL1MOiMv1s6Iwdtk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038