UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Tal7V0urkCcmApJSxqip93/nxh45EbS2O99hZanpug=' 
WHERE 
  key_id = '6832160aefd8888cb2a20fdd54c777b17ce71384eabfa41f3e9375887d6e7cca' 
  AND (
    token = '0Tal7V0urkCcmApJSxqip93/nxh45EbS2O99hZanpug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049