UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'okScwvzFEVhJLPB246D+p2elc/clMYQRrA8nhWmJhC8=' 
WHERE 
  key_id = '864c7b69de10752dc64839ba5abc86b03329a9de9e849c43a81b0b27096f3089' 
  AND (
    token = 'okScwvzFEVhJLPB246D+p2elc/clMYQRrA8nhWmJhC8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030