UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n9NpIbSnK9+hhVsqF5iPyl+LdtBVMIsdrrocXcBoj4I=' 
WHERE 
  key_id = 'c5c3c67c4ed88b0df694578ecebe7202efeee955620b11b85d7478cd1c5ae104' 
  AND (
    token = 'n9NpIbSnK9+hhVsqF5iPyl+LdtBVMIsdrrocXcBoj4I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031