UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gKoyJuV71mA/xA5goa+yEQJqsKOlgZcrDfMHhhCXDEI=' 
WHERE 
  key_id = '96e48ea30ff7a3c8af5ffbbd6ee0d61cbc0c95e82cae220a67dd790b7e1d82a6' 
  AND (
    token = 'gKoyJuV71mA/xA5goa+yEQJqsKOlgZcrDfMHhhCXDEI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025