UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AW6bUunm9/LMmAkD9o42L1RB2Z+31xq0SgKqlvNVQ4M=' 
WHERE 
  key_id = '6e660e81e904c17ed0fd78e65adbf539090b3f96dd23c2b089d1263e819b6409' 
  AND (
    token = 'AW6bUunm9/LMmAkD9o42L1RB2Z+31xq0SgKqlvNVQ4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036