UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YNOBosSS+vFWEpBVAm8ayLYlEgFdxn60QfCoGdjoHa4=' 
WHERE 
  key_id = 'bbf6e698ba4b58b2dcd0591d2689c0f3f6bdcfe0f1f852f72c235d3e82dee848' 
  AND (
    token = 'YNOBosSS+vFWEpBVAm8ayLYlEgFdxn60QfCoGdjoHa4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031