UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n8m9GH1AMz0ZmuFWDqceH6pBqB/yeVkgXGfZpdrED+I=' 
WHERE 
  key_id = '7d3b1fa28b3302783202c5ea4c586abb69249bcd01b05bd933cd1580880b44d7' 
  AND (
    token = 'n8m9GH1AMz0ZmuFWDqceH6pBqB/yeVkgXGfZpdrED+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041