UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wUdLElhkA+jzm7/1tUVigh9S7EtZkGy6M3cH8lCUUr0=' 
WHERE 
  key_id = '981211d19373683e82edd21ee230878c23da419df820970f13c014e801db4447' 
  AND (
    token = 'wUdLElhkA+jzm7/1tUVigh9S7EtZkGy6M3cH8lCUUr0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032