UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fyGrDPs+o6NZTcqMC3X4n9EuCXmK0o2McCXZtWv3LgM=' 
WHERE 
  key_id = '148887410d54a909acf15e666fb152c3312382306a3352ed33f36261434f28a2' 
  AND (
    token = 'fyGrDPs+o6NZTcqMC3X4n9EuCXmK0o2McCXZtWv3LgM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036