UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PpZiXEJIOY32rtKZTGkhAOGlyKs4E7h5VfKCi12Dl9g=' 
WHERE 
  key_id = 'b74c100ef903f1cb7575cb95aa0ad56815c6abf9e878ab042a3242a1dbe1e8ca' 
  AND (
    token = 'PpZiXEJIOY32rtKZTGkhAOGlyKs4E7h5VfKCi12Dl9g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047