UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e0Ukpfzfw37l/99i13qXJZrx88Tryt8LMwF/3fxqGQ8=' 
WHERE 
  key_id = '3be5c3e719c49a3e18606c7381f3cedea5ab679008a5ac68d190ac5c55c32587' 
  AND (
    token = 'e0Ukpfzfw37l/99i13qXJZrx88Tryt8LMwF/3fxqGQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030