UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pdMhlNzK8KddkiNEnOM291Z9vlyHOcG+oFDfJAK3VwU=' 
WHERE 
  key_id = '029e301c1da9806febd1a964c3f19771146c7338ae1185753266cd9377a92e18' 
  AND (
    token = 'pdMhlNzK8KddkiNEnOM291Z9vlyHOcG+oFDfJAK3VwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035