UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'npd89ie7+JpxVrZwnPkp1JDUYbwhQo9DsmRk0j915/A=' 
WHERE 
  key_id = '640ee0a24aab2aed49606b39b5a7fd3355ded0e2910edf12207c77799d5e43dc' 
  AND (
    token = 'npd89ie7+JpxVrZwnPkp1JDUYbwhQo9DsmRk0j915/A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037