UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rdM2HEHBvZht+ZwIVm2vgdz001y/VduQfbYz436QDhA=' 
WHERE 
  key_id = '408390416752180e734f332ce37f321221e2486ae1fa96a78b5c460f6dab0b51' 
  AND (
    token = 'rdM2HEHBvZht+ZwIVm2vgdz001y/VduQfbYz436QDhA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030