UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jj0IXxUe0tQOwIeuyPmOHI1TyBkCpWpm9Bduzw44NiA=' 
WHERE 
  key_id = '1fac32ed1da9922f58f7daeab98ad15821fc4e80907bcb74351116929f483b95' 
  AND (
    token = 'Jj0IXxUe0tQOwIeuyPmOHI1TyBkCpWpm9Bduzw44NiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033