UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Noe527LcWgLUTlrYOn3OinidKPQXQGw++94TFNDYFB4=' 
WHERE 
  key_id = '30cc28dcad1733e929b4cf76fa3bc21d118d60d1a2b9f4cded9e7f5fd0a084f7' 
  AND (
    token = 'Noe527LcWgLUTlrYOn3OinidKPQXQGw++94TFNDYFB4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052