UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TPeLZaHFaXNM8i3iAZdSo4V04+uQQ3QwfwT8VM9G9qo=' 
WHERE 
  key_id = 'a35b7a5f5db5683bd09991ed0071ad9efdfe748ffcdaeb7607754bfc6829fb86' 
  AND (
    token = 'TPeLZaHFaXNM8i3iAZdSo4V04+uQQ3QwfwT8VM9G9qo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039