UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NxPSf9crAQsBhGr5xuk2tKh0X2xAYzCNHKjGQ25aW6Q=' 
WHERE 
  key_id = '8f99000a5989bd798e22237dd9923b9bd634673068bfac6b9ad1e03f406466c2' 
  AND (
    token = 'NxPSf9crAQsBhGr5xuk2tKh0X2xAYzCNHKjGQ25aW6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038