UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hkKicJAdtfaR0euAU/NUEi1xqWY5qcTdNWTxXulX6Cs=' 
WHERE 
  key_id = '4a3dc5a6e1697c981efe2da8c4f6ec07da8df8b2cd1ad38b7ce62f2a8764844b' 
  AND (
    token = 'hkKicJAdtfaR0euAU/NUEi1xqWY5qcTdNWTxXulX6Cs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026